﻿@model List<Galaxy.Entities.Document>
@section styles{
    <link href="~/lib/AdminLTE/plugins/datatables/dataTables.bootstrap.css" rel="stylesheet" asp-append-version="true" />
    <link href="~/css/base.css" rel="stylesheet" asp-append-version="true" />
}
@section scripts{
    <script src="~/js/base.js" asp-append-version="true"></script>
    <script src="~/js/base-message.js"></script>
    <script src="~/view-resources/Views/Document/Index.js" asp-append-version="true"></script>
}

<div class="content-wrapper" id="mainDiv" style="min-height: 935px;">
    <!-- Content Header (Page header) -->
    <section class="content-header">
        <h1>
            文章管理 
            <small>列表</small>
        </h1>
        <ol class="breadcrumb">
            <li><a href=""><i class="fa fa-dashboard"></i> 首页</a></li>
            <li><a href="#">系统工具</a></li>
            <li class="active">文章管理</li>
        </ol>
    </section>

    <!-- Main content -->
    <section class="content">
        <div class="row">
            <div class="col-xs-12">
                <div class="box">
                    <!-- /.box-header -->
                    <div class="box-body">
                        <div id="markdown_table_wrapper" class="dataTables_wrapper form-inline dt-bootstrap no-footer">
                            <div class="row">
                                <div class="col-sm-3">
                                    <div class="dataTables_length" id="markdown_table_length">
                                        <label>
                                            <select id="markdown_page" name="markdown_table_length" aria-controls="markdown_table" class="form-control input-sm">
                                                <option value="10">10</option>
                                                <option value="20">20</option>
                                                <option value="50">50</option>
                                                <option value="-1">全部</option>
                                            </select> 记录/页
                                        </label>
                                    </div>
                                </div>
                                <div class="col-sm-9">
                                    <div class="dataTables_filter" id="searchDiv">
                                        <input placeholder="请输入文章标题" name="title" class="form-control" type="search" likeoption="true" />
                                        <input placeholder="请输入关键字" name="keywords" class="form-control" type="search" likeoption="true" />

                                        <div class="btn-group">
                                            <button type="button" class="btn btn-primary" data-btn-type="search">查询</button>
                                            <button type="button" class="btn btn-default" data-btn-type="reset">重置</button>
                                        </div>
                                        <div class="btn-group">
                                            <button type="button" class="btn btn-default" data-btn-type="add"><i class="fa fa-pencil">&nbsp;新增文章</i></button>
                                        </div>
                                    </div>
                                </div>
                            </div>
                            <div class="row">
                                <div class="col-sm-12">
                                    <table id="markdown_table" class="table table-border table-hover dataTable no-footer" style="width: 100%;" role="grid" aria-describedby="markdown_table_info">
                                        <thead>
                                            <tr role="row">
                                                <th class="text-center sorting_disabled" rowspan="1" colspan="1" aria-label="序号">序号</th>
                                                <th class="sorting text-center" tabindex="0" aria-controls="markdown_table" rowspan="1" colspan="1" aria-label="文章标题: activate to sort column ascending">文章标题</th>
                                                <th class="sorting_disabled text-center" rowspan="1" colspan="1" aria-label="关键字">关键字</th>
                                                <th class="sorting_disabled text-center" rowspan="1" colspan="1" aria-label="关键字">创建时间</th>
                                                <th class="text-center sorting_disabled" rowspan="1" colspan="1" aria-label="操作">操作</th>
                                            </tr>
                                        </thead>
                                        <tbody>
                                            @for (int i = 0; i < Model.Count(); i++)
                                            {
                                                <tr id="@Model[i].Id" role="row" class='@(i % 2 == 0 ? "odd" : "even")'>
                                                    <td class="text-center sorting_1">@(((ViewBag.PageIndex-1) * ViewBag.PageSize) + i + 1)</td>
                                                    <td class="text-left">@Model[i].Title</td>
                                                    <td class="text-left">@Model[i].KeyWords</td>
                                                    <td class="text-center">@Model[i].CreateTime.ToString("yyyy-MM-dd")</td>
                                                    <td class="text-center">
                                                        <a href="#" data-btn-type="preview"><i class="fa">浏览</i></a>&nbsp;&nbsp;
                                                        <a href='@Url.Content("~/Document/Edit/" + Model[i].Id)'><i class="fa">编辑</i></a>&nbsp;&nbsp;
                                                        <a href="#" data-btn-type="delete"><i class="fa">删除</i></a>
                                                    </td>
                                                </tr>
                                            }
                                        </tbody>
                                    </table>
                                </div>
                            </div>
                            @Html.Raw(ViewBag.Page)
                        </div>
                    </div>
                    <!-- /.box-body -->
                </div>
            </div>
            <!-- /.col -->
        </div>
        <!-- /.row -->
    </section>
</div>
<!--隐藏域-->
<input type="hidden" id="pageIndex" value="@ViewBag.PageIndex " />
<input type="hidden" id="pageSize" value="@ViewBag.PageSize " />
<input type="hidden" id="key" value="@ViewBag.Key " />